Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] connector_ecommerce #75

Merged
merged 77 commits into from
Apr 18, 2023

Conversation

juliocabrerizo
Copy link

@juliocabrerizo juliocabrerizo commented Oct 4, 2022

Related issue: #74

Dependencies:
OCA/connector#441

@oca-clabot
Copy link

Hey @juliocabrerizo, thank you for your Pull Request.

It looks like some users haven't signed our Contributor License Agreement, yet.
You can read and sign our full Contributor License Agreement here: https://odoo-community.org/page/cla
Here is a list of the users:

Appreciation of efforts,
OCA CLAbot

@juliocabrerizo juliocabrerizo changed the title 16.0 mig connector ecommerce [16.0][MIG] connector_ecommerce Oct 4, 2022
@juliocabrerizo juliocabrerizo force-pushed the 16.0-mig-connector_ecommerce branch from bd39525 to bc7ad39 Compare October 4, 2022 09:55
@juliocabrerizo juliocabrerizo force-pushed the 16.0-mig-connector_ecommerce branch 2 times, most recently from 42dd416 to 3b42e7a Compare January 24, 2023 08:32
guewen and others added 25 commits January 30, 2023 15:04
[FIX] decimal_precision import does not use openerp.addons namespace
[FIX] remove an old view not installable
[IMP] finish onchange support, add doc string, support tax. The option use external taxe will be not implemented, as re-computing tax in OpenERP is the best option. If you need it, create a independant module for it, fix copyright

[REF] refactor introduce the class SaleOrderOnChange
…ork, + support adding extra s.o. lines on the fly

add comments on the internals of SaleOrderOnChange.play()
[IMP] work on stock.picking.out instead of stock.picking

[REM] clean delivery carrier old code

[ADD] a connector hook in the stock.picking.out view

[FIX] action_done is not called on stock.picking.out but only on stock.picking

[CHG] rename base_sale_data.xml to ecommerce_data.xml

[ADD] hook in invoice view for connectors

[ADD] account_invoice.origin_order_id, link to the order which created the invoice

[REF] moved sale.py code to old_stuff.py

[ADD] copy the order id to the invoice it creates

[REM] remove code

[REF] move content of partner.py to old_stuff.py

[REF] move partner_view.xml content to old_xml_stuff.xml

[REF] moved code from product.py to old_stuff.py

[REF] removed views and act_window links to ir.model.data from sale_view.xml

[REF] removed external.referential.category.csv

[REF] remove obsolete access groups

[REF] comment out the sale exception until its reimplementation

[REF] removed the import order wizard

[REF] removed connector.py

[FIX] style

[REF] moved external_referential.py code to old_stuff.py

[REF] remove empty files

[ADD] hook for connectors in sale view

[FIX] do not load removed file

[REF] updated __openerp__ manifest, changed copyright attribution to reflect the facts, changed the license from GPL to AGPL-3

[FIX] reintroduce methods used for the import of magento sale orders

[FIX] connector_ecommerce: replace dependencies on sale_quick_payment by sale_quick_payment

[ADD] connector_ecommerce: add import_rule and days_before_cancel in payment.method, theses fields will be used by the connectors

[IMP] connector_ecommerce: call the onchanges on the sale order to apply the workflow default values

[IMP] connector_ecommerce: activate the options 'Allow different addresses', 'Multiple shop', 'Discount on SO lines'

[FIX] noupdate=1 on the global settings activation

[FIX] missing name in a view

[IMP] add hints in payment method view to help in the choice of the import rules

[ADD] on_product_price_changed Event, fired when the price of a product could have changed

As the price is a fields.function based on the contextual pricelist, we can never be sure
that a price has changed, it depends on the context.

So we search all the base fields used to compute the price, and if one of these has changed,
the event is fired.

[FIX] initialize the context when None

[IMP] reviewed the connector_ecommerce's description in the manifest __openerp__.py

[FIX] remove obsolete sale exception

[ADD] fields cancelled_in_backend and cancellation_resolved to handle the cancellation of the sales orders from a backend

[IMP] add a notification when a user choose to not cancel a sales order cancelled on the backend

[ADD] notification when a sales order is cancelled on the backend

[IMP] ignore the cancellation from the backend should be done by a sales manager only

[IMP] ask for a reason when the sale order is not cancelled despite the cancellation on the backend

[FIX] filter on cancels should exclude the resolved cancels

[ADD] a parent_id field on the sale order, base implementation, the logic needs to be implemented in the connectors due to their own specificities

[ADD] button to open the parent sale order

[ADD] sale exception preventing confirmation of a sale order when it has a parent order cancelled on the backend

[IMP] add the sales manager rights to the connector manager because they usually need these rights

[IMP] fields 'need_cancel' and 'parent_need_cancel'

[FIX] spells cancelled with the US form: canceled

[FIX] typos in views

[FIX] hide the 'keep open' button in canceled state

[ADD] when we write 'canceled_in_backend' in a sales order, try to automatically cancel it

[FIX] filter out already cancelled sales orders from the filter 'to cancel'

[FIX] domain for the invisible attribute of the 'keep open' button, logic was reversed

[IMP] add a note on the related pickings and invoices of an order cancelled from backend

[FIX] cancelation of sales order: quotation states requires to be canceled via the workflow, sales order states with the action_cancel method. Some states can not be canceled.

[ADD] sale exception when an ordered product has a pending connector checkpoint

[ADD] french translation
…horized by a payment institute but not paid yet.
… orders (shipping, ...), need a refactoring of the Mapper though. WIP
…ne for prestashoperpconnect in a first place to be able to add or not the tax on delivery lines)
[ADD] a test which check if on_invoice_validated is correctly fired

[ADD] test the fire of 'on_invoice_paid'

[FIX] formatting of the onchange test

[FIX] fix the failing test: the payment_method_id and workflow_payment_id are not mandatory in a sale order

[FIX] fr_FR.po files not loaded, should be named fr.po

[FIX] context not propagated

[ADD] docstring

[CHG] rename ExtraOrderLineBuilder to SpecialOrderLineBuilder

[FIX] use session

[ADD] deprecation warning

[IMP] allow to use a product id or a product browse_record in lines builders

[FIX] Sales Orders onchanges: allow to have lines with other commands than (0, 0, {values}).

[FIX] simplify last change

[FIX] in lines builders, product_ref is not mandatory if we provide a product, renames 'product_id' to 'product', keeping ambiguity as we can have an int or browse_record.

[IMP] propagate the 'shop_id' in the context if it exists so the fiscal position rules (from openerp-fiscal-rules' project) can apply automatically

[FIX] 'int' object is not iterable error

[FIX] 'int' object is not iterable error, again
…ity by default so they are likely to appear at the bottom, shipping line being the last one
@@ -0,0 +1,7 @@
from openupgradelib import openupgrade

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this directory must be deleted

return res

def notify_invoice_validate(self):
for record in self.filtered(lambda m: m.move_type == "out_invoice"):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change this to

for record in self:
    if move_type != "out_invoice":
        continue

return result

@api.model
def create(self, vals):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2023-03-10 15:28:49,600 1 WARNING gl_433 odoo.api.create: The model odoo.addons.connector_ecommerce.models.product is not overriding the create method in batch

invoice.message_post(body=message)

@api.model
def create(self, values):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2023-03-10 15:28:49,601 1 WARNING gl_433 odoo.api.create: The model odoo.addons.connector_ecommerce.models.sale is not overriding the create method in batch

self._event("on_product_price_changed").notify(product)

def write(self, vals):
result = super(ProductTemplate, self).write(vals)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply PEP 3135 (28-Apr-2007) to "super()."

self.sequence = 999

def get_line(self):
values = super(ShippingLineBuilder, self).get_line()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply PEP 3135 (28-Apr-2007) to "super()."

_usage = "order.line.builder.cod"

def __init__(self, work_context):
super(CashOnDeliveryLineBuilder, self).__init__(work_context)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply PEP 3135 (28-Apr-2007) to "super()."

_usage = "order.line.builder.gift"

def __init__(self, work_context):
super(GiftOrderLineBuilder, self).__init__(work_context)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply PEP 3135 (28-Apr-2007) to "super()."

self.sequence = 990

def get_line(self):
line = super(GiftOrderLineBuilder, self).get_line()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply PEP 3135 (28-Apr-2007) to "super()."

def _compute_tax_group_id(self):
self.ensure_one()
taxes = self.taxes_id
self.tax_group_id = taxes[:-1].tax_group_id.id

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not correct, if you can some taxes_id and you make taxes[:-1] get more result.

>>> list_element = [1,2,3,4]
>>> list_element[:-1]
[1, 2, 3]

and if after you get tax_group_id some element you can get singleton.

>>> self.env["account.tax"].search([]).tax_group_id.id
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/mnt/environment/odoo-server/odoo/fields.py", line 5035, in __get__
    raise ValueError("Expected singleton: %s" % record)
ValueError: Expected singleton: account.tax.group(1, 2)

I think the right thing to do is
taxes[-1:].tax_group_id.id

>>> list_element = [1,2,3,4]
>>> list_element[-1:]
[4]
>>> list_element = []
>>> list_element[-1:]
[]


@api.model
def _price_changed_fields(self):
return {"list_price", "lst_price", "standard_price"}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lst_price does not exist in product template


@api.model
def _price_changed_fields(self):
return {"lst_price", "standard_price", "price", "price_extra"}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

price field dead in V16 May he rest in peace

I would change the return to

    @api.model
    def _price_changed_fields(self):
        return {
            "lst_price",
            "price_extra",
        } | self.product_tmpl_id._price_changed_fields()

@asierneiradev
Copy link

Hi @RodrigoBM !

Thank you very much for the suggested changes.

Could you check again the PR proposal ?

Regards

@asierneiradev asierneiradev force-pushed the 16.0-mig-connector_ecommerce branch 2 times, most recently from 9191596 to 791a828 Compare March 28, 2023 09:06
@asierneiradev asierneiradev force-pushed the 16.0-mig-connector_ecommerce branch from 791a828 to 6cfac49 Compare March 28, 2023 10:52
@john-herholz-dt
Copy link

@RodrigoBM can you merge this?

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@RodrigoBM
Copy link

@john-herholz-dt I wish I could, but I have not yet been blessed with that power.

@john-herholz-dt
Copy link

/ocabot merge

@OCA-git-bot
Copy link
Contributor

Hi @john-herholz-dt. Your command failed:

Required option bumpversion_mode for command merge. Possible values : major, minor, patch, nobump.

Ocabot commands

  • ocabot merge major|minor|patch|nobump
  • ocabot rebase
  • ocabot migration {MODULE_NAME}

More information

@john-herholz-dt
Copy link

/ocabot migration connector_ecommerce

@OCA-git-bot
Copy link
Contributor

Sorry @john-herholz-dt you are not allowed to mark the addon tobe migrated.

To do so you must either have push permissions on the repository, or be a declared maintainer of all modified addons.

If you wish to adopt an addon and become it's maintainer, open a pull request to add your GitHub login to the maintainers key of its manifest.

@john-herholz-dt
Copy link

@lmignon can you merge this PR?

@lmignon
Copy link
Contributor

lmignon commented Apr 18, 2023

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 16.0-ocabot-merge-pr-75-by-lmignon-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 3338eb6 into OCA:16.0 Apr 18, 2023
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 0c1d739. Thanks a lot for contributing to OCA. ❤️

@john-herholz-dt
Copy link

Thanks @lmignon you helped a lot with this. I can finally continue using this module for production.

@asierneiradev asierneiradev deleted the 16.0-mig-connector_ecommerce branch April 18, 2023 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.