Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions connector_woocommerce/i18n/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,12 @@ msgstr ""
msgid "Export Product Template Since"
msgstr ""

#. module: connector_woocommerce
#: model:ir.model.fields,field_description:connector_woocommerce.field_woocommerce_backend__export_product_tmpl_id
#: model_terms:ir.ui.view,arch_db:connector_woocommerce.woocommerce_backend_view_form
msgid "Export Product Template by ID"
msgstr "Exportar plantilla de producte per ID"

#. module: connector_woocommerce
#: model:ir.model.fields,field_description:connector_woocommerce.field_woocommerce_backend__export_product_tmpl_since_date
msgid "Export Product Templates Since"
Expand All @@ -1521,6 +1527,12 @@ msgstr ""
msgid "Export Product public category Since"
msgstr ""

#. module: connector_woocommerce
#: model:ir.model.fields,field_description:connector_woocommerce.field_woocommerce_backend__export_product_id
#: model_terms:ir.ui.view,arch_db:connector_woocommerce.woocommerce_backend_view_form
msgid "Export Product Variant by ID"
msgstr "Exportar variant de producte per ID"

#. module: connector_woocommerce
#: model:ir.model.fields,field_description:connector_woocommerce.field_woocommerce_backend__export_products_since_date
#: model_terms:ir.ui.view,arch_db:connector_woocommerce.woocommerce_backend_view_form
Expand Down Expand Up @@ -1903,6 +1915,24 @@ msgstr ""
msgid "If empty, company default (if any) or default will be applied."
msgstr ""

#. module: connector_woocommerce
#: model:ir.model.fields,help:connector_woocommerce.field_woocommerce_backend__export_product_tmpl_id
msgid ""
"If set, the export ignores the 'since' date and exports only this product "
"template by its Odoo ID."
msgstr ""
"Si s'informa, l'exportació ignora la data 'des de' i exporta només aquesta "
"plantilla de producte pel seu ID d'Odoo."

#. module: connector_woocommerce
#: model:ir.model.fields,help:connector_woocommerce.field_woocommerce_backend__export_product_id
msgid ""
"If set, the export ignores the 'since' date and exports only this product "
"variant by its Odoo ID."
msgstr ""
"Si s'informa, l'exportació ignora la data 'des de' i exporta només aquesta "
"variant de producte pel seu ID d'Odoo."

#. module: connector_woocommerce
#: model:ir.model.fields,help:connector_woocommerce.field_woocommerce_res_partner__team_id
msgid ""
Expand Down
30 changes: 30 additions & 0 deletions connector_woocommerce/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,12 @@ msgstr ""
msgid "Export Product Template Since"
msgstr ""

#. module: connector_woocommerce
#: model:ir.model.fields,field_description:connector_woocommerce.field_woocommerce_backend__export_product_tmpl_id
#: model_terms:ir.ui.view,arch_db:connector_woocommerce.woocommerce_backend_view_form
msgid "Export Product Template by ID"
msgstr "Exportar plantilla de producto por ID"

#. module: connector_woocommerce
#: model:ir.model.fields,field_description:connector_woocommerce.field_woocommerce_backend__export_product_tmpl_since_date
msgid "Export Product Templates Since"
Expand All @@ -1521,6 +1527,12 @@ msgstr ""
msgid "Export Product public category Since"
msgstr ""

#. module: connector_woocommerce
#: model:ir.model.fields,field_description:connector_woocommerce.field_woocommerce_backend__export_product_id
#: model_terms:ir.ui.view,arch_db:connector_woocommerce.woocommerce_backend_view_form
msgid "Export Product Variant by ID"
msgstr "Exportar variante de producto por ID"

#. module: connector_woocommerce
#: model:ir.model.fields,field_description:connector_woocommerce.field_woocommerce_backend__export_products_since_date
#: model_terms:ir.ui.view,arch_db:connector_woocommerce.woocommerce_backend_view_form
Expand Down Expand Up @@ -1903,6 +1915,24 @@ msgstr ""
msgid "If empty, company default (if any) or default will be applied."
msgstr ""

#. module: connector_woocommerce
#: model:ir.model.fields,help:connector_woocommerce.field_woocommerce_backend__export_product_tmpl_id
msgid ""
"If set, the export ignores the 'since' date and exports only this product "
"template by its Odoo ID."
msgstr ""
"Si se informa, la exportación ignora la fecha 'desde' y exporta solo esta "
"plantilla de producto por su ID de Odoo."

#. module: connector_woocommerce
#: model:ir.model.fields,help:connector_woocommerce.field_woocommerce_backend__export_product_id
msgid ""
"If set, the export ignores the 'since' date and exports only this product "
"variant by its Odoo ID."
msgstr ""
"Si se informa, la exportación ignora la fecha 'desde' y exporta solo esta "
"variante de producto por su ID de Odoo."

#. module: connector_woocommerce
#: model:ir.model.fields,help:connector_woocommerce.field_woocommerce_res_partner__team_id
msgid ""
Expand Down
24 changes: 22 additions & 2 deletions connector_woocommerce/models/backend/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,20 @@ def _check_page_size(self):
import_sale_order_since_date = fields.Datetime(
string="Import Sale Order Since",
)
export_product_tmpl_id = fields.Many2one(
comodel_name="product.template",
string="Export Product Template by ID",
copy=False,
help="If set, the export ignores the 'since' date and exports only this "
"product template by its Odoo ID.",
)
export_product_id = fields.Many2one(
comodel_name="product.product",
string="Export Product Variant by ID",
copy=False,
help="If set, the export ignores the 'since' date and exports only this "
"product variant by its Odoo ID.",
)
stock_location_ids = fields.Many2many(
string="Locations",
comodel_name="stock.location",
Expand All @@ -122,17 +136,23 @@ def export_product_tmpl_since(self):
since_date = fields.Datetime.from_string(rec.export_product_tmpl_since_date)
rec.export_product_tmpl_since_date = fields.Datetime.now()
self.env["woocommerce.product.template"].export_product_tmpl_since(
backend_record=rec, since_date=since_date
backend_record=rec,
since_date=since_date,
product=rec.export_product_tmpl_id,
)
rec.export_product_tmpl_id = False

def export_products_since(self):
self.env.user.company_id = self.company_id
for rec in self:
since_date = fields.Datetime.from_string(rec.export_products_since_date)
rec.export_products_since_date = fields.Datetime.now()
self.env["woocommerce.product.product"].export_products_since(
backend_record=rec, since_date=since_date
backend_record=rec,
since_date=since_date,
product=rec.export_product_id,
)
rec.export_product_id = False

def export_sale_orders_since(self):
self.env.user.company_id = self.company_id
Expand Down
6 changes: 4 additions & 2 deletions connector_woocommerce/models/product_product/binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ def _get_base_domain(self):

# TODO: Review Why is export_products_since used instead of overriding
# the export_data function?
def export_products_since(self, backend_record=None, since_date=None):
def export_products_since(self, backend_record=None, since_date=None, product=None):
domain = self._get_base_domain()
if since_date:
if product:
domain.append(("id", "=", product.id))
elif since_date:
domain.append(
("woocommerce_write_date", ">", fields.Datetime.to_string(since_date))
)
Expand Down
8 changes: 6 additions & 2 deletions connector_woocommerce/models/product_template/binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ def _get_base_domain(self):
("has_attributes", "=", False),
]

def export_product_tmpl_since(self, backend_record=None, since_date=None):
def export_product_tmpl_since(
self, backend_record=None, since_date=None, product=None
):
domain = self._get_base_domain()
if since_date:
if product:
domain.append(("id", "=", product.id))
elif since_date:
domain = [
(
"woocommerce_write_date",
Expand Down
24 changes: 24 additions & 0 deletions connector_woocommerce/views/woocommerce_backend_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@
class="oe_inline"
nolabel="1"
/>
<div groups="base.group_no_one">
<label
string="Export Product Template by ID"
class="oe_inline"
for="export_product_tmpl_id"
/>
<field
name="export_product_tmpl_id"
class="oe_inline"
nolabel="1"
/>
</div>
</div>
<button
name="export_product_tmpl_since"
Expand All @@ -152,6 +164,18 @@
class="oe_inline"
nolabel="1"
/>
<div groups="base.group_no_one">
<label
string="Export Product Variant by ID"
class="oe_inline"
for="export_product_id"
/>
<field
name="export_product_id"
class="oe_inline"
nolabel="1"
/>
</div>
</div>
<button
name="export_products_since"
Expand Down
Loading